package com.arpa.oms.service;

import com.arpa.oms.domain.dto.OmsReceivableDetailDTO;
import com.arpa.oms.domain.entity.OmsReceivableDetail;
import com.arpa.oms.domain.vo.OmsReceivableDetailVO;
import com.arpa.wms.domain.dto.ExpenseDetailSettlementDTO;
import com.baomidou.mybatisplus.extension.service.IService;

import java.math.BigDecimal;
import java.util.List;
import java.util.concurrent.Future;

/**
 * <p>
 * OMS应收明细 服务类
 * </p>
 *
 * @author LEO
 * @since 2020-11-17
 */
public interface IOmsReceivableDetailService extends IService<OmsReceivableDetail> {

    /**
     * 保存
     * @param entity
     * @return
     */
    @Override
    boolean save(OmsReceivableDetail entity);

    /**
     * 根据code更新实体
     * @param entity
     * @return
     */
    int updateByCode(OmsReceivableDetail entity);

    /**
     * 查询列表
     * @param omsReceivableDetailDTO
     * @return
     */
    List<OmsReceivableDetailVO> queryList(OmsReceivableDetailDTO omsReceivableDetailDTO);

    /**
     * 查询合计,包含总数
     * @param omsReceivableDetailDTO
     * @return
     */
    OmsReceivableDetailVO queryListSum(OmsReceivableDetailDTO omsReceivableDetailDTO);

    /**
     * 检查费用是否可以结算
     * @param code
     * @return
     */
    Future check(ExpenseDetailSettlementDTO.SettlementItem code);


    /**
     * 生成结算单时更新费用金额
     * @param code 费用明细标识
     * @param thisSettledMoney  本次结算金额
     * @param byCode 操作人code
     * @param name 操作人姓名
     */
    void updateSettlementMoney(String code, BigDecimal thisSettledMoney, String byCode, String name);

    /**
     * 删除、修改结算单后还原收费信息
     * @param code 费用标识
     * @param restoreSettledMoney 要还原的金额
     */
    void restoreSettlementStatus(String code, BigDecimal restoreSettledMoney, BigDecimal amountReduce);

    /**
     * 收款单审核通过后确认收费信息
     * @param code 费用标识
     * @param confirmMoney 确认金额
     */
    void confirmSettlementStatus(String code, BigDecimal confirmMoney);
}
